<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>for循环案例</title>
</head>
<body>
    <!-- 1 求1-100之间所有数的平均值
    2 求1-100之间所有偶数和奇数的和
    3 求1-100之间所有能被3 整除的和 -->
    <script>
        var sum = 0;
        var average = 0; // average平均值的意思
        for (var  i=1; i<=100;i++){
            sum += i;
        }
        average = sum / 100;
        console.log(average);

    </script>

    <script>
        var odd = 0;
        var even = 0;
    for (var i=1; i<=100; i++){
        if (i % 2 == 0){
            even = even +i;
        }else{
            odd = odd + i;
        }
    }
    console.log(even);
    console.log(odd);

    </script>
    <script>
        var result = 0;
        for (var i = 1; 1 <= 100; i++){
            if(i / 3 == 0){
                result = result + i;
            }
        }
        console.log(result);
    </script>
</body>
</html>